#include <iostream>
#include <vector>
#include <utility>

// Reads an integer from standard input.
static int read_int()
{
	int n = 0;
	std::cin >> n;
	return n;
}

#if 0
// Solves Ax = B (mod P).
static void solve_congruence_linear_system(
	std::vector<std::vector<int>> &A,
	std::vector<int> &B,
	std::vector<int> &x,
	int P)
{
	int n = (int)x.size();
	std::vector<int> row(n); // used to swap rows in the equation
	for (int i = 0; i < n; i++)
		row[i] = i;

	// Transform matrix A to triangular.
	for (int j = 0; j < n; j++)
	{
		// Find the first equation with a non-zero coefficient for x_j,
		// and swap this row to row j if it is not.
		if (A[row[j]][j] == 0)
		{
			int i = j + 1;
			while (i < n && A[row[i]][j] == 0)
				i++;
			if (i >= n) 
			{
				// The coefficients of x_j are all zero, so x_j is a free variable.
				// In the context of this problem, we let x_j = 0 in this case.
				continue;
			}
			std::swap(row[i], row[j]);
		}

		// Eliminate x_j from each equation after equation j.
		int a = A[row[j]][j];
		e
	}
}
#endif

// Solves ax = b (mod P). 
// If not solvable, returns -1. 
// If more than one solutions, returns 0.
static int solve_congruence(int a, int b, int P)
{

}

// Solves AX = B (mod P). Input [A B] as augment matrix.
static void solve_congruence_linear_system(
	std::vector<std::vector<int>> &A,
	std::vector<int> &x,
	int P)
{
	int n = (int)x.size();

	// Transform matrix A to triangular.
	for (int k = 0; k < n; k++)
	{
		// Find the first equation with a non-zero coefficient for x_k.
		if (A[k][k] == 0)
		{
			int i = k + 1;
			while (i < n && A[i][k] == 0)
				i++;
			if (i >= n) 
			{
				// The coefficients of x_j are all zero, so x_j is a free variable.
				// In the context of this problem, we let x_j = 0 in this case.
				continue;
			}
			std::swap(A[i], A[k]);
		}

		// Eliminate x_k from each equation after equation k.
		long long a1 = A[k][k];
		for (int i = k + 1; i < n; i++)
		{
			long long a2 = A[i][k];
			if (a2 != 0)
			{
				// A[i,k:n] = A[i,k:n]*A[k][k] - A[k,k:n]*A[i][k]
				for (int j = k; j <= n; j++)
				{
					A[i][j] = (A[i][j]*a1 - A[k][j]*a2) % P;
				}
			}
		}
	}

	// Now A is a triangle matrix. We solve the x's backwards.
	for (int k = n-1; k >= 0; k--)
	{
		long long b = A[k][n];
		for (int j = k+1; j < n; j++)
			b -= (long long)A[k][j]*x[j];
		x[k] = solve_congruence(A[k][k], b % P, P);
	}
}

void astar_2011_r1b_2()
{
	// Read inputs.
	int n = read_int();
	int P = read_int();
	int s = read_int();
	int t = read_int();

	// Create congruence linear system.
	std::vector<std::vector<int>> xy(n);
	for (int i = 0; i < n; i++)
	{
		xy[i].resize(n+1);
		int c = 1;
		for (int j = 0; j < n; j++)
		{
			xy[i][j] = c;
			c = (c * (s + i)) % P;
		}
		xy[i][n] = read_int();
	}

	// Solve congruence linear system.
	std::vector<int> A(n);
	solve_congruence_linear_system(xy, A, P);

	// Generate next x numbers.
	for (int xx = s + n; xx < s + n + t; xx++)
	{
		int yy = 0;
		int c = 1;
		for (int i = 0; i < n; i++)
		{
			yy = (yy + (long long)c * A[i]) % P;
			c = (c * xx) % P;
		}
		std::cout << yy << (xx==s+n+t-1 ? "\n" : " ");
	}
}